package com.hexacta.hrs.repositories;

import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.vectrics.employee.Employee;
import org.vectrics.location.Location;

import com.hexacta.hrs.domain.staffing.assignment.EmployeeAssignment;
import com.hexacta.hrs.services.staffing.impl.EmployeeAssignmentDTO;
import com.hexacta.hrs.services.staffing.impl.SimpleEmployeeAssignmentDTO;

public interface EmployeeAssignmentRepository extends RecordObjectRepository<EmployeeAssignment> {
    void saveOrUpdate(Object o);

    EmployeeAssignment findById(long id);

    List<EmployeeAssignment> findAll();

    List<EmployeeAssignment> findAllIncludingNoAssignableToProjectEmployees();

    /**
     * Devuelve las asignaciones que tienen ocurrencia entre las fechas
     * especificadas
     * 
     * @author ldeveikis
     * @return
     */
    List<EmployeeAssignment> findAssignmentsBetweenDates(Date dateFrom, Date dateTo,
            boolean onlyAssignableAsProjectMember);

    public Collection<EmployeeAssignment> getAssigmentsForThisPeriod(Employee employee, String period);

    boolean checkAssignmentByYear(String year);

    /**
     * @param selectedEmployee
     * @param showTentative
     * @param asignadoCliente
     * @param addonAvailable
     * @param addonNotAvailable
     * @param interno
     * @param roles
     * @param proyectId
     * @param dateFrom
     * @param dateTo
     * @param onlyElegibleAsProjectMember
     * @param location 
     * @return
     */
    Collection<EmployeeAssignmentDTO> getMatchingAssigmentDTOsBetweenDates(Employee selectedEmployee,
            boolean showTentative, boolean asignadoCliente, boolean addonAvailable, boolean addonNotAvailable,
            boolean interno, String[] roles, String proyectId, Date dateFrom, Date dateTo,
            boolean onlyElegibleAsProjectMember, Location location);

    /**
     * @param selectedEmployee
     * @param roles
     * @param dateFrom
     * @param dateTo
     * @param onlyElegibleAsProjectMember
     * @return
     */
    Collection<SimpleEmployeeAssignmentDTO> getSimpleMatchingAssigmentDTOsBetweenDates(Employee selectedEmployee,
            String[] roles, Date dateFrom, Date dateTo, boolean onlyElegibleAsProjectMember);
    
    List<EmployeeAssignment> findAssignmentsByEmployee(Employee employee);

	boolean checkAssigmentIsCharged(EmployeeAssignment employeeAssignment);

	Calendar availabilityInMonths(Employee employee);
    
}
